package com.wuxiaofan.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wuxiaofan.config.Idgenerator;
import com.wuxiaofan.entity.UserInfo;
import com.wuxiaofan.entity.custom.UserInfoCustom;
import com.wuxiaofan.mapper.UserInfoMapper;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserInfoService {
    @Autowired
    private UserInfoMapper userInfoMapper;
    @Resource
    private Idgenerator idgenerator;
    public UserInfo findById(String id){
        return userInfoMapper.selectById(id);
    }

    public UserInfoCustom findCountByMap(Map paraMap){
        return userInfoMapper.findCountByMap(paraMap);
    }

    public UserInfoCustom findGroupByMap(Map paraMap){
        return userInfoMapper.findGroupByMap(paraMap);
    }

    public List<UserInfoCustom> findByMap(Map paraMap){
        return userInfoMapper.findByMap(paraMap);
    }

    public Page<UserInfoCustom> findByMap(Map paraMap, Page page){
        return page.setRecords(userInfoMapper.findByMap(paraMap,page));
    }


    public void updateMapById(Map paraMap){
        userInfoMapper.updateMapById(paraMap);
    }
    public void delById(String id){
        userInfoMapper.deleteById(id);
    }

    public UserInfo save(UserInfo userInfo){
        userInfo.setId(idgenerator.getId());
        userInfoMapper.insert(userInfo);
        return userInfo;
    }

}
